package com.deyuanyun.pic.ctrl.enumeration;

import com.deyuanyun.pic.ctrl.domain.RecodeAnodesbed;
import com.deyuanyun.pic.ctrl.domain.RecodeAntiSurge;
import com.deyuanyun.pic.ctrl.domain.RecodeCpJumper;
import com.deyuanyun.pic.ctrl.domain.RecodeCpPower;
import com.deyuanyun.pic.ctrl.domain.RecodeCpTestStation;
import com.deyuanyun.pic.ctrl.domain.RecodeDrainage;
import com.deyuanyun.pic.ctrl.domain.RecodeInsedJoint;
import com.deyuanyun.pic.ctrl.domain.RecodeReference;
import com.deyuanyun.pic.ctrl.domain.RecodeSaalAnode;
import com.deyuanyun.pic.ctrl.mapper.RecodeAnodesbedMapper;
import com.deyuanyun.pic.ctrl.mapper.RecodeAntiSurgeMapper;
import com.deyuanyun.pic.ctrl.mapper.RecodeCpJumperMapper;
import com.deyuanyun.pic.ctrl.mapper.RecodeCpPowerMapper;
import com.deyuanyun.pic.ctrl.mapper.RecodeCpTestStationMapper;
import com.deyuanyun.pic.ctrl.mapper.RecodeDrainageMapper;
import com.deyuanyun.pic.ctrl.mapper.RecodeInsedJointMapper;
import com.deyuanyun.pic.ctrl.mapper.RecodeReferenceMapper;
import com.deyuanyun.pic.ctrl.mapper.RecodeSaalAnodeMapper;

/**
 *  设备运行记录相关枚举
 *  @author axiao(xj08.dream@gmail.com)
 *  @date 2017-01-06
 *  @version 1.0
 *  Histroy: [修改人][时间][描述]
 */
public enum OperationRecordEnum {
    
    CPPOWER(4, "阴保电源运行记录", RecodeCpPowerMapper.class, RecodeCpPower.class), //阴保电源运行记录
    REFERENCE(4, "长效参比运行记录", RecodeReferenceMapper.class, RecodeReference.class), //长效参比运行记录
    ANODESBED(3, "阳极地床运行记录", RecodeAnodesbedMapper.class, RecodeAnodesbed.class), //辅助阳极地床运行记录
    INSULATEDJOINT(4, "绝缘装置运行记录", RecodeInsedJointMapper.class, RecodeInsedJoint.class), //绝缘装置运行记录
    ANTISURGE(3, "防浪涌保护器运行记录", RecodeAntiSurgeMapper.class, RecodeAntiSurge.class), //防浪涌保护器运行记录
    CPJUMPER(5, "跨接线运行记录", RecodeCpJumperMapper.class, RecodeCpJumper.class), //阴极保护跨接线运行记录
    CPTESTSTATION(4, "阴保测试桩运行记录", RecodeCpTestStationMapper.class, RecodeCpTestStation.class), //阴保测试桩运行记录
    SAALANODE(3, "牺牲阳极运行记录", RecodeSaalAnodeMapper.class, RecodeSaalAnode.class), //牺牲阳极运行记录
    CURRENTDRAINAGE(4, "排流装置运行记录", RecodeDrainageMapper.class, RecodeDrainage.class); //排流地床运行记录

    //9大设备运行记录导出excel模板路径
    private String[] expExcelPathStrs = {"/template/excl/ctrl/recode_cpPower.xls", "/template/excl/ctrl/recode_reference.xls", "/template/excl/ctrl/recode_anodesbed.xls",
            "/template/excl/ctrl/recode_insedJoint.xls", "/template/excl/ctrl/recode_antiSurge.xls", "/template/excl/ctrl/recode_cpJumper.xls",
            "/template/excl/ctrl/recode_cpTestStation.xls", "/template/excl/ctrl/recode_saalAnode.xls", "/template/excl/ctrl/recode_drainage.xlsx"};

    private int tempExpIndex; //导出模板数组中的下标,
    private String expName; //模板导出名字
    private Class mapperCls; //对应的mapper
    private Class domainCls; //对应的实体

    private OperationRecordEnum(int tempExpIndex, String expName, Class mapperCls, Class domainCls) {
        this.tempExpIndex = tempExpIndex;
        this.expName = expName;
        this.mapperCls = mapperCls;
        this.domainCls = domainCls;
    }

    public int getTempExpIndex() {
        return tempExpIndex;
    }

    public String getExpName() {
        return expName;
    }

    public Class getMapperCls() {
        return mapperCls;
    }

    public Class getDomainCls() {
        return domainCls;
    }

    /**
     * 获取导出模板的路径
     * @return
     * @author axiao(xj08.dream@gmail.com)
     * @date 2017-01-06
     */
    public String getExpExcelPath() {
        return expExcelPathStrs[this.ordinal()];
    }

    public static OperationRecordEnum getInstance(String str) {
        OperationRecordEnum[] exprotEna = OperationRecordEnum.values();
        for (OperationRecordEnum operationRecordEnum : exprotEna) {
            String name = operationRecordEnum.name();
            if (name.equals(str)) {
                return operationRecordEnum;
            }
        }
        return exprotEna[0];
    }
}